﻿using System;
using Splendor_Server.script.db;
using Splendor_Server.script.logic;
using Splendor_Server.script.net;

namespace Splendor_Server
{
    static class MainClass
    {
        public static void Main(string[] args)
        {
            int count = 1;
            while (!DbManager.Connect("game", "127.0.0.1", 3306, "root", ""))
            {
                Console.WriteLine("[{0}]数据库连接失败，重连中，重连次数：{1}", NetManager.GetNowTime(), count);
                ++count;
                if (count > 6)
                {
                    Console.WriteLine("[{0}]数据库重连失败次数过多，已退出程序！", NetManager.GetNowTime());
                    return;
                }
            }

            GameSpawn.Init();
            //这一行一定得放在最后面，所有初始化操作都得放在这一行之前；因为StartLoop里while死循环
            NetManager.StartLoop(8888);
        }
    }
}



